using Godot;
using System;

public partial class VFXManager : Node2D
{
    [Signal]
    public delegate void OnVFXEndEventHandler();
    WeaponRepairVFX weaponRepairVFX;

    VFXBlink vfxBlink;

    public override void _Ready()
    {
        base._Ready();
        weaponRepairVFX = GetNode<WeaponRepairVFX>("WeaponRepairVFX");
        weaponRepairVFX.OnVFXEnd += VFXEnd;

        vfxBlink = GetNode<VFXBlink>("VFXBlink");
        vfxBlink.OnVFXEnd += VFXEnd;
    }

    private void VFXEnd()
    {
        GameManager.Instance.AllowInput();
        EmitSignal(SignalName.OnVFXEnd);
    }


    public void VFXWeaponRepair(Vector2 pos, int amount)
    {
        GameManager.Instance.LockInput();
        weaponRepairVFX.Play(pos, amount);
    }

    public void VFXBlink(Vector2 pos)
    {
        GameManager.Instance.LockInput();
        vfxBlink.Play(pos);
    }
}
